import { CustomForm } from '@/components/ProForm/interface';
import { requestTypeOptions, usePlugInOptions } from '../basic/options';

export const useOverall = propsKeys => {
  let overallForm = reactive<CustomForm>({
    form: {},
    formAttrs: {},
    title: '',
    visible: false,
    transitionArr: [],
    options: [
      {
        type: 'input',
        label: 'id',
        prop: 'id',
        hide: true
      },
      {
        type: 'input',
        label: 'visible',
        prop: 'visible',
        hide: true,
        defaultValue: false
      },
      {
        type: 'input',
        label: '表单名称',
        prop: 'formName',
        hide: false,
        rules: [
          {
            required: true,
            message: '表单名称',
            trigger: 'blur'
          }
        ]
      },
      {
        type: 'input',
        label: '编号(ref)',
        prop: 'ref',
        defaultValue: 'addForm',
        hide: false,
        rules: [
          {
            required: true,
            message: '编号',
            trigger: 'blur'
          }
        ]
      },

      {
        type: 'input',
        label: '表单提交',
        prop: 'saveForm.submitForm',
        hide: false,
        defaultValue: '',
        attrs: {
          type: 'textarea',
          autosize: {
            minRows: 5,
            maxRows: 8
          }
        }
      },
      {
        type: 'select',
        label: '使用的插件',
        prop: 'usePlugIn',
        hide: false,
        defaultValue: ['formUtils'],
        attrs: {
          multiple: true,
          filterable: true
        },
        children: usePlugInOptions
      }
    ]
  });
  return {
    overallForm
  };
};
